from fastapi import FastAPI
app = FastAPI()
from pydantic import BaseModel
from datetime import datetime
import uvicorn

print("正在初始化，请耐心等候……")


class MyClassModel(BaseModel):
    question: str


@app.get("/")
def read_root():
    return {"Hello": "World"}



@app.post("/mind/api")
def create_myclass(myclass: MyClassModel):
    question=myclass.question
    print("问题："+question)

    t1 = datetime.now()

    t2 = datetime.now()
    second = (t2 - t1).total_seconds()
    output="我是8093"

    print("输出："+output)
    print(f"耗时{second}")

    #return {"output": f"{answer}"}

    return {
        "code": "200",
        "msg": "success",
        "data": {"output": f"{output}"}
    }



if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8093)